﻿using LFramework.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace DataServices
{
    public class DaoAdminLogin
    {
        IDBHelper dbhelper = DBFactory.CreateFromConfig("conn");

        public bool CheckLogin(string userId, string password)
        {
            string sql = "select * from tbUser where UserName = '" + userId + "' and Password = '" + password + "'";

            DataTable dt = dbhelper.QueryForDataTable(sql);

            return dt.Rows.Count > 0;
        }


        public void ModifyPassword(string userId, string password)
        {
            string sql = "update tbUser set [password] = '" + password + "' where username ='" + userId + "'";

            dbhelper.ExecuteSQL_InTrans(sql); 
        }
    }
}
